package com.example.healthcondition.mapper;

import com.example.healthcondition.entity.DietRecords;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface DietRecordsMapper {

    @Select("SELECT * FROM dietrecords WHERE record_id = #{recordId}")
    DietRecords selectById(@Param("recordId") Integer recordId);

    @Insert("INSERT INTO dietrecords (user_id, food_item, calories, serving_size, meal_type, recorded_at) " +
            "VALUES (#{userId}, #{foodItem}, #{calories}, #{servingSize}, #{mealType}, #{recordedAt})")
    @Options(useGeneratedKeys = true, keyProperty = "recordId")
    int insertDietRecord(DietRecords dietRecords);
}